package com.example.wechat;

import android.annotation.SuppressLint;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.Button;

import androidx.appcompat.app.AppCompatActivity;

import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentTransaction;

public class LoginActivity extends AppCompatActivity implements View.OnClickListener{


    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.login);
        Button register=findViewById(R.id.register);
        Button login=findViewById(R.id.login);
        register.setOnClickListener(this);
        login.setOnClickListener(this);
    }

    @SuppressLint("ResourceType")
    @Override
    public void onClick(View view) {
        switch (view.getId()){
            case R.id.register:
                Intent intent1=new Intent(LoginActivity.this,RegisterActivity.class);

                startActivity(intent1);
                Log.d("LoginActivity", "你你你你你你你你你你你你你你你你你你你你");
                break;
            case R.id.login:
                Intent intent2=new Intent(LoginActivity.this, MainActivity.class);

                startActivity(intent2);
                setragment setragment =new setragment();
               UserInfoFragment userInfoFragment = new UserInfoFragment();
               FragmentManager fragmentManager =getSupportFragmentManager();
               FragmentTransaction transaction =fragmentManager.beginTransaction();
               transaction.replace(R.layout.set_fragment,userInfoFragment);
               transaction.commit();
                Log.d("LoginActivity", "你你你你你你你你你你你你你你你你你你你你");
                break;

        }

    }


}